package com.CGFrame.struts.action.categorySet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.CGFrame.struts.POJOs.Catemodel;
import com.CGFrame.struts.POJOs.Company;
import com.CGFrame.struts.bean.ProjectOperate;
import com.CGFrame.struts.bean.ProjectOperateFactory;
import com.CGFrame.struts.bean.log.LogHistoryBean;

public class DelModelAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		ProjectOperate pop = ProjectOperateFactory.getprojectOperate();
		String cateModelId = request.getParameter("cateModelId");
		int cateMId = Integer.parseInt(cateModelId);
		
		pop.deleteObject( "Catemodel", Integer.parseInt(cateModelId) );

		LogHistoryBean logBean = new LogHistoryBean();
		String regUserId = (String)request.getSession().getAttribute("RegUserID");
		logBean.saveByReguserId(regUserId, LogHistoryBean.DELETE,null, "Catemodel", Integer.parseInt(cateModelId));
		
		return mapping.findForward("showmodel");
	}
}
